﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HotelManagement._02.BUS;
using HotelManagement._04.OBJECT;

namespace HotelManagement._01.FORM
{
    public partial class F13_WorkingTimeManagement : Form
    {
        public F13_WorkingTimeManagement()
        {
            InitializeComponent();
            Init();
            LoadDataToGrid();
        }
        Time m_Time;
        TimeBUS m_TimeBUS;


        private void Init()
        {
            m_Time = new Time();
            m_TimeBUS = new TimeBUS();
        }
        private void LoadDataToGrid()
        {
            m_dgv_Time.DataSource = m_TimeBUS.ViewTime();
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void m_dgv_Time_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                m_Time.ID =int.Parse(m_dgv_Time.Rows[m_dgv_Time.CurrentCell.RowIndex].Cells["ID"].Value.ToString());
            }
            catch (Exception)
            {

                MessageBox.Show("Bạn chưa chọn nhân viên nào !");
            }
        }

        private void Delete_Click(object sender, EventArgs e)
        {

        }


        private void search_Click(object sender, EventArgs e)
        {
            m_dgv_Time.DataSource = m_TimeBUS.Search(m_txt_Keyword.Text);
            m_txt_Keyword.Text = "";
        }

        private void m_dgv_Time_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }      
    }
}
